package com.icehand.axon.demo.controller;

import org.axonframework.commandhandling.gateway.CommandGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.icehand.axon.demo.command.commands.TestCommand;

import lombok.extern.slf4j.Slf4j;

/**
 * @author icehand
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class TestAccountController {
	@Autowired
	private CommandGateway commandGateway;

	/**
	 * 创建用户
	 */
	@RequestMapping(method = RequestMethod.POST)
	
	public void create(@RequestBody TestCommand command) {

		log.info("command:abc:" + command.getAbc());
		commandGateway.send(command);
	}
}
